import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
// // 需要左方向动画的路由用this.$router.to('****')
// Router.prototype.togo = function (path) {
//   this.isleft = true
//   this.isright = false
//   this.push(path)
// }
// // 需要右方向动画的路由用this.$router.goRight('****')
// Router.prototype.goRight = function (path) {
//   this.isright = true
//   this.isleft = false
//   this.push(path)
// }
// // 需要返回按钮动画的路由用this.$router.goBack()，返回上一个路由
// Router.prototype.goBack = function () {
//   this.isright = true
//   this.isleft = false
//   this.go(-1)
// }
// // // 点击浏览器返回按钮执行，此时不需要路由回退
// Router.prototype.togoback = function () {
//   this.isright = true
//   this.isleft = false
// }
// // // 点击浏览器前进按钮执行
// Router.prototype.togoin = function () {
//   this.isright = false
//   this.isleft = true
// }


export default new Router({
  routes: [
    {
      path: '/',
      name: 'index',
      component: (resolve) => require(['@/pages/layout/index'], resolve),
      redirect: '/home',
      children: [
        {
          path: '/home',
          name: 'home',
          meta: {
            title: "首页",
            idx: 1
          },
          component: (resolve) => require(['@/pages/index/home'], resolve)
        }, {
          path: '/user/register',
          name: 'register',
          meta: {
            title: "注册",
            idx: 301,
          },
          component: (resolve) => require(['@/pages/user/register'], resolve)
        }
        , {
          path: '/user/forgetPassword',
          name: 'forgetPassword',
          meta: {
            title: "忘记密码",
            idx: 302
          },
          component: (resolve) => require(['@/pages/user/forgetPassword'], resolve)
        },
        {
          path: '/user/recharge',
          name: 'recharge',
          meta: {
            title: "充值",
            idx: 303
          },
          component: (resolve) => require(['@/pages/user/recharge'], resolve)
        },
        {
          path: '/user/rechargeResult',
          name: 'rechargeResult',
          meta: {
            title: "充值结果",
            idx: 30301
          },
          component: (resolve) => require(['@/pages/user/rechargeResult'], resolve)
        },
        {
          path: '/user/invitation',
          name: 'invitation',
          meta: {
            title: '邀请好友',
            idx: 304
          },
          component: (resolve) => require(['@/pages/user/invitation'], resolve)
        },
        {
          path: '/user/promotionRecord',
          name: 'promotionRecord',
          meta: {
            title: "推广记录",
            idx: 305
          },
          component: (resolve) => require(['@/pages/user/promotionRecord'], resolve)
        },
        {
          path: '/user/withdrawal',
          name: 'withdrawal',
          meta: {
            title: "我要提现",
            idx: 306,
          },
          component: (resolve) => require(['@/pages/user/withdrawal'], resolve)
        },
        {
          path: '/user/security',
          name: 'security',
          meta: {
            title: "账户安全",
            idx: 307
          },
          component: (resolve) => require(['@/pages/user/security'], resolve)
        },
        {
          path: '/user/myBankcard',
          name: 'myBankcard',
          meta: {
            title: "我的银行卡",
            idx: 308
          },
          component: (resolve) => require(['@/pages/user/myBankcard'], resolve)
        },
        {
          path: '/user/addBankcard',
          name: 'addBankcard',
          meta: {
            title: "添加银行卡",
            idx: 30801
          },
          component: (resolve) => require(['@/pages/user/addBankcard'], resolve)
        },
        {
          path: '/user/userfundlist',
          name: 'userfundlist',
          meta: {
            title: "资金流水记录",
            idx: 309
          },
          component: (resolve) => require(['@/pages/user/userfundlist'], resolve)
        },
        {
          path: '/user/investment',
          name: 'investment',
          meta: {
            title: "我的投资",
            idx: 310
          },
          component: (resolve) => require(['@/pages/user/investment'], resolve)
        },
        {
          path: '/user/abonus',
          name: 'abonus',
          meta: {
            title: "租金分红记录",
            idx: 311,
          },
          component: (resolve) => require(['@/pages/user/abonus'], resolve)
        },
        {
          path: '/user/realname',
          name: 'realname',
          meta: {
            title: "实名认证",
            idx: 30701
          },
          component: (resolve) => require(['@/pages/user/realname'], resolve)
        },
        {
          path: '/user/changePassword',
          name: 'changePassword',
          meta: {
            title: "修改登陆密码",
            idx: 30702
          },
          component: (resolve) => require(['@/pages/user/changePassword'], resolve)
        },
        {
          path: '/user/changePayPassword',
          name: 'changePayPassword',
          meta: {
            title: "修改支付密码",
            idx: 30703
          },
          component: (resolve) => require(['@/pages/user/changePayPassword'], resolve)
        },
        {
          path: '/product',
          name: 'product',
          meta: {
            title: "投资项目",
            idx: 2,
          },
          component: (resolve) => require(['@/pages/index/product'], resolve)
        },
        {
          path: '/user',
          name: 'user',
          meta: {
            title: "个人中心",
            idx: 31,
          },
          component: (resolve) => require(['@/pages/index/user'], resolve)
        },
        {
          path: '/login',
          name: 'login',
          meta: {
            title: "登录",
            idx: 3,
          },
          component: (resolve) => require(['@/pages/index/login'], resolve)
        },
        {
          path: '/aboutus',
          name: 'aboutus',
          meta: {
            title: "关于我们",
            idx: 41,
          },
          component: (resolve) => require(['@/pages/index/aboutus'], resolve)
        },
        {
          path: '/aboutus/details/:id',
          name: 'aboutusDetails',
          meta: {
            title: "详情",
            idx: 40102
          },
          component: (resolve) => require(['@/pages/aboutus/details'], resolve)
        },
        {
          path: '/aboutus/list/:id',
          name: 'aboutusList',
          meta: {
            title: "关于我们",
            // keepAlive:true,
            idx: 401
          },
          component: (resolve) => require(['@/pages/aboutus/list'], resolve)
        },
        {
          path: '/product/pay',
          name: 'productPay',
          meta: {
            title: "立即投资",
            idx: 20201

          },
          component: (resolve) => require(['@/pages/product/pay'], resolve)
        },
        {
          path: '/user/email',
          name: 'email',
          meta: {
            title: "系统邮件",
            idx: 312
          },
          component: (resolve) => require(['@/pages/user/email'], resolve)
        },
        {
          path: '/user/letter',
          name: 'letter',
          meta: {
            title: "新增邮件",
            idx: 31201
          },
          component: (resolve) => require(['@/pages/user/letter'], resolve)
        },
        {
          path: '/user/sendretLetter',
          name: 'sendretLetter',
          meta: {
            title: "回复邮件",
            idx: 31202
          },
          component: (resolve) => require(['@/pages/user/sendretLetter'], resolve)
        },
        {
          path: '/user/getLetter',
          name: 'getLetter',
          meta: {
            title: "查看邮件",
            idx: 31203
          },
          component: (resolve) => require(['@/pages/user/getLetter'], resolve)
        },
        {
          path: '/home/calculator',
          name: 'calculator',
          meta: {
            title: "计算收益",
            idx: 101
          },
          component: (resolve) => require(['@/pages/home/calculator'], resolve)
        },
        {
          path: '/home/yieldResult',
          name: 'yieldResult',
          meta: {
            title: "收益结果",
            idx: 10101
          },
          component: (resolve) => require(['@/pages/home/yieldResult'], resolve)
        }, {
          path: '/product/details',
          name: 'productDetails',
          meta: {
            title: '产品详情',
            idx: 201
          },
          component: (resolve) => require(['@/pages/product/details'], resolve)
        },
        {
          path: '/user/contract',
          meta: {
            title: '合同详情',
            idx: 31001
          },
          name: 'contract',
          component: (resolve) => require(['@/pages/user/contract'], resolve)
        }
      ]
    },
    {
      path: '*',
      name: 'index',
      redirect: '/home',
    }
  ]
})
